<template>
  <div>
    <ul>
      <li v-for="(val,index) in arr" :key="index">{{val}}</li>
      
    </ul>
    <button @click="soBtn">排序</button>
    <button @click="reBtn">反转</button>
    <button @click="sBtn">截取前三个</button>
    <button @click="upBtn">点击改掉第一个的值</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr:[5,3,7,9,11,20]
    }
  },
  methods: {
    soBtn(){
      this.arr.sort()
    },
    reBtn(){
      this.arr.reverse()
    },
    sBtn(){
     this.arr = this.arr.slice(0,3)
    },
    upBtn(){
      this.$set(this.arr,0,'老李')
    }
  }
}
</script>

<style>

</style>